<div class="boxed clearfix">
  <div class="ad-box rech-s">
    <div class="account-infor">
      <h3>
        <span>充值分店信息</span>
      </h3>
      <div class="rech-studio">
        <ul class="clearfix">

          <% @studios.each do |studio| %>
          <li>
            <div class="re-studio">
              <div class="sub-con">
                <div class="test-check">
                  <input type="checkbox" class="ck">
                  <div class="check">
                    <span></span>
                  </div>
                </div>
              </div>
              <b><%= studio.name %></b>
            </div>
            <div class="re-studio">
              <span>上次购买日期:</span>
              <em><%= studio.last_buy_at.strftime("%Y/%m/%d") %></em>
            </div>
            <div class="re-studio">
              <span>截止日期:</span>
              <em><%= studio.invalidate_at.strftime("%Y/%m/%d") %></em>
            </div>
          </li>
        <% end %>
        </ul>
      </div>
    </div>
    <div>
      <div class="re-year clearfix">
        <b>充值年数:</b>
        <div class="rey-con">
          <span class="reduce-year"></span>
          <input type="text" class="rech-year" onkeyup="intNum(this)" id="reYear">
          <em>年</em>
          <span class="plus-year"></span>
        </div>
      </div>
      <div class="re-year clearfix">
        <b>支付方式:</b>
        <div class="rey-box">
          <div class="rey-con">
            <input class="p-radio" type="radio" name="recharge">
            <div class="ra-btn">
              <span></span>
            </div>
            <em>支付宝</em>
          </div>
          <div class="rey-con">
            <input class="p-radio" type="radio" name="recharge">
            <div class="ra-btn">
              <span></span>
            </div>
            <em>微信</em>
          </div>
        </div>
      </div>
      <div class="re-year re-z clearfix">
        <b>总计:</b>
        <em>1000</em>
        <span>元（单家工作室）x</span>
        <em>1</em>
        <span>年x</span>
        <em>2</em>
        <span>家工作室=</span>
        <em>2000</em>
        <span>元</span>
      </div>
      <div class="re-year re-b clearfix">
        <span>如需发票，付款后可以直接在线索取发票，我们提供正规的增值税普通发票并会按照你提供的地址快递邮寄过去（包邮费）</span>
      </div>
    </div>
    <div class="com-sbtn">保存</div>
  </div>
</div>

<script src="/assets/js/common-list.js"></script>
<script>
$(".rey-box .ra-btn").on("click", function() {
  $(".rey-con .ra-btn").removeClass("ra-checked");
  $(this).addClass("ra-checked");
  $(this).prev("input").prop("checked", true);
});
$(".reduce-year").on("click", function() {
  if ($("#reYear").val() == "") {
    $("#reYear").val(0);
  } else {
    if (Number($("#reYear").val()) > 0) {
      $("#reYear").val(Number($("#reYear").val()) - 1);
    };
  }
});
$(".plus-year").on("click", function() {
  if ($("#reYear").val() == "") {
    $("#reYear").val(1);
  } else {
    console.log(Number($("#reYear").val()));
    $("#reYear").val(Number($("#reYear").val()) + 1);
  }
});
</script>
